#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <gpio/gpio.h>

#define LED_NUM     6

int run;

void quit(int)
{
    run = 0;
}

int main(void)
{
    gpio *led[LED_NUM];
    int gpionum[LED_NUM] = {54, 55, 56, 45, 44, 62};

    /* */
    for (int i = 0; i < LED_NUM; i++) {
        led[i] = new gpio(gpionum[i]);
        led[i]->opendev();
        led[i]->set_diretion(0);
    }

    /* */
    run = 1;
    signal(SIGINT, quit);
    while(run) {
        for (int i = 0; i < LED_NUM; i++) {
            led[i]->set_value(0);
            usleep(100000);
            led[i]->set_value(1);
            usleep(100000);
        }
        for (int i = 0; i < LED_NUM; i++) {
            led[i]->set_value(0);
        }
        usleep(300000);
    }

    /* */
    for (int i = 0; i < LED_NUM; i++) {
        led[i]->set_value(1);
        led[i]->closedev();
    }

    return 0;
}
